import router from "@/router";
import { changeTitle } from "@/common/title";

const globalMethods = {
	install: (app, options) => {
		// 添加全局方法
		app.config.globalProperties.$toPage = function (url, onNewPage) {

			if (onNewPage) {
				window.open(url, "_blank");
			} else {
				router.push(url);
			}
		};

		// 添加全局方法
		app.config.globalProperties.$changeTitle = changeTitle;

		// 如果需要，你也可以根据options进行一些配置处理
		if (options && options.customOption) {
			console.log(`Custom option received: ${options.customOption}`);
		}
	},
};

export default globalMethods;
